package controllers;

import java.util.List;

import models.Entities;
import models.SearchEntitiesResults;
import play.mvc.Controller;
/**This is a class controller to call the methods necessary to perform 
 * the search for Entities
 * 
 * @Author Mohamed Ali
 */
public class SearchForEntities extends Controller
{
	/**Method to be called afterwards in the navigation
	 * of the view
	 * 
	 * @Author Mohamed Ali
	 */
	public static void entityIndex()
	{
		render();
	}
	/**Method to call searchForEntities Method that does the whole search
	 * and shows results of the search as well as the search word entered after taking input from 
	 * the user  . It is also to be used afterwards in the nviagtion of the view.
	 * 
	 * 
	 * @Author Mohamed Ali
	 */
	public static void searchEntities()
	{
		String search=params.get("search");
		SearchEntitiesResults results=Entities.searchForEntities("search");
		List<Entities> entity2=results.entity;
		render(results,entity2,search);
	}
	/**Method to be called afterwards in navigation
	 * of the view to show the entities
	 * @params id
	 * @Author Mohamed Ali
	 */
	public static void showEntities(long id)
	{
		Entities e=Entities.findById(id);
		render(e);
	}
}
